package com.arnold.guide.sparkSql.demo01

import org.apache.spark.sql.SparkSession

/**
  * Created by arnold.zhu on 2017/7/24.
  */
object Demo01 {

  private val sparkSession: SparkSession = SparkSession.builder().master("local").appName("LearnSparkSQL").getOrCreate()

  def main(args: Array[String]): Unit = {

    val path:String = Thread.currentThread().getContextClassLoader.getResource("sparksql/demo01/people.json").getPath

    val df = sparkSession.read.json(path)

    df.show()

//    +----+-------+
//    | age|   name|
//    +----+-------+
//    |null|Michael|
//    |  30|   Andy|
//    |  19| Justin|
//    +----+-------+
  }

}
